<?php

namespace App\Entities;

use Illuminate\Foundation\Auth\User as Authenticatable;

class UserModel extends Authenticatable
{
    protected $table = 'users';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name',
        'phone',
        'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'remember_token',
    ];

    // 我的地址
    public function addresses()
    {
        return $this->hasMany(UserAddressModel::class);
    }

    // 我的订单
    public function orders()
    {
        return $this->hasMany(OrderModel::class, 'user_id');
    }
}
